package com.gxa.xc.rbac.config;

import com.gxa.xc.rbac.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 系统的配置类
 * @author:IT-CNLM
 * @date:Created at 2020/10/22
 */
@Configuration
public class SysWebConfig implements WebMvcConfigurer {


    /**
     * 添加拦截器的方法
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册登陆拦截器
        registry.addInterceptor(new LoginInterceptor())
                // 配置拦截的方法: 到底要拦截什么方法
                .addPathPatterns("/**")
                // 放行 登陆页面以及登陆的操作
                .excludePathPatterns("/login/page","/login/do")
                // 放行静态资源
                .excludePathPatterns("/css/**","/fonts/**","/images/**","/js/**","/lib/**");
    }


}
